package com.kly.cashmall.base.app_action;

import com.kly.cashmall.utils.data.TextUtil;

/**
 * @author
 * @date 2017/9/2
 */
public enum ActionEnums {
    /**
     * 普通H5页面
     */
    URLJS(ActionHeads.URLJS),

    /**
     * 普通H5页面
     */
    URLNONJS(ActionHeads.URLNONJS),
    /**
     * 外部H5页面
     */
    URLExternal(ActionHeads.URLExternal),

    /**
     * 拨打电话
     */
    TEL(ActionHeads.TEL),


    /**
     * 信息列表
     */
    LMActionProfile(ActionHeads.LMActionProfile),
    /**
     * 产品确认
     */
    LMActionProductConfirm(ActionHeads.LMActionProductConfirm),
    /**
     * 登录
     */
    LMActionLogin(ActionHeads.LMActionLogin),
    /**
     * 产品列表
     */
    LMActionProductList(ActionHeads.LMActionProductList),
    /**
     * 首页
     */
    LMActionHome(ActionHeads.LMActionHome),
    /**
     * 订单列表
     */
    LMActionOrderList(ActionHeads.LMActionOrderList),
    /**
     * 订单详情
     */
    LMActionOrderDetail(ActionHeads.LMActionOrderDetail),
    /**
     * 我的
     */
    LMActionMine(ActionHeads.LMActionMine),
    /**
     * 产品详情
     */
    LMActionProductDetail(ActionHeads.LMActionProductDetail),
    /**
     * 个人信息
     */
    LMActionPersonalInfo(ActionHeads.LMActionPersonalInfo),
    LMActionPersonalAadhaar(ActionHeads.LMActionPersonalAadhaar),
    /**
     * KYC认证选择
     */
    LMActionKYCDocuments(ActionHeads.LMActionKYCDocuments),
    /**
     * 产品确认成功
     */
    LMActionProductConfirmSuccess(ActionHeads.LMActionProductConfirmSuccess),
    /**
     * 账单详情
     */
    LMActionRepayDetails(ActionHeads.LMActionRepayDetails),
    /**
     * HighMark授权
     */
    LMActionHighMarkAuthorization(ActionHeads.LMActionHighMarkAuthorization),
    /**
     * HighMark答题
     */
    LMActionHighmark(ActionHeads.LMActionHighmark),
    /**
     * 通知
     */
    LMActionNotice(ActionHeads.LMActionNotice),
    /**
     * 模仿首页
     */
    LMActionHomeProduct(ActionHeads.LMActionHomeProduct),
    /**
     * 授信
     */
    LMActionAuditCalculation(ActionHeads.LMActionAuditCalculation),
    /**
     * 关闭app
     */
    LMActionFinish(ActionHeads.LMActionFinish),
    /**
     * 签到
     */
    LMActionCheckIn(ActionHeads.LMActionCheckIn),

    /**
     * 支付结果
     */
    LMActionRepayResult(ActionHeads.LMActionRepayResult),
    /**
     * 关于我们
     */
    LMActionAboutUs(ActionHeads.LMActionAboutUs),
    /**
     * 手机号登录
     */
    LMActionMobileLogin(ActionHeads.LMActionMobileLogin),
    /**
     * 跳转Google Play寻找某个app
     */
    LMActionJumpGoogle(ActionHeads.LMActionJumpGoogle),
    /**
     * 退出登录
     */
    LMActionLogout(ActionHeads.LMActionLogout);

    private String head;

    ActionEnums(String head) {
        this.head = head;
    }

    public boolean isMatch(String action) {
        if (TextUtil.isEmpty(action)) {
            return false;
        }
        if (head.equals(action)) {
            return true;
        }
        if (head.endsWith("/") || head.endsWith("?")) {
            return action.startsWith(head);
        } else {
            return action.startsWith(head + "/") || action.startsWith(head + "?");
        }
    }
}
